The BindingExtender component has two configurable event links that allow it to automatically go online or offline:
- OnlineEventSource: Event triggered by this source puts the binding extender into the online mode.
- OfflineEventSource: Event triggered by this source puts the binding extender into the online mode.
Depending on the kind of project, Live Binding uses following rules to determine the default settings of these properties:
- In Windows Forms, when you initially place the BindingExtender component onto a Windows form by dragging it from a Toolbox, its OnlineEventSource is set to the Form’s Shown event, and its OfflineEventSource is set to the Form’s FormClosing event.
- In WPF, when you initially place the BindingExtender component onto a component tray by adding it from Toolbox Items, its OnlineEventSource is set to the root object's Loaded event, and its OfflineEventSource is set to the root object's Closed event. The root object is normally the window being designed.
The effect of this configuration is such that during runtime, the binding extender is automatically online while the form or window is open, and it also goes offline when the form or window closes.
This default setting makes it easy to create forms that are “live” (online) without further coding or configuration. If you, however, want to have control over the process, you can clear these event sources, and use the BindingExtender's Online property to set or reset the online state.
See Also